<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
	<script type="text/javascript" src="../js/jquery.js"></script>
	<script type="text/javascript" src="../js/jquery.cookie.js"></script>
	<link type="text/css" rel="stylesheet" href="../<s:property value="#session.themeStyle.mainCss" default="Skin/PM/LightBlue/main.css"/>" />
	<script type="text/javascript">
	
		var lastABg = null;

		$(document).ready(function() {
			$('#navLeft .a1').bind('click', function() {
					changeShow(this);
			});
			$('#navLeft .leftli .leftul a').bind('click', function() {
					changeBG(this);
			});
		
			var ulArr = $('#navLeft .leftli .leftul');
			
			for ( var i = 0; i < ulArr.length; i++) {
				$(ulArr[i]).height($(window).height()-36-33*$(".leftul").length);
			}
		
			//左边高度自适应
			$(window).resize(function(){
				for ( var i = 0; i < ulArr.length; i++) {
					$(ulArr[i]).height($(window).height()-36-33*$(".leftul").length);
				}
			});
		});
		
		function changeBG(obj) {
			if (lastABg != null) {
				$(lastABg).css("background-color", "white").css("color", "white");
			}
			$(obj).css("background-color", "white").css("color", "#46A0ED");//white
			lastABg = obj;
		}
		
		function changeShow(leftli) {
			var currUi = $(leftli).next(".leftul")[0];
			var leftul = $('#navLeft .leftul');
			
			for ( var i = 0; i < leftul.length; i++) {
				if(currUi == leftul[i]) {
					//打开
					if ($(leftul[i]).css("display") == "none") {
						$(leftul[i]).animate( {
							height : 'toggle',
							opacity : 'toggle'
						}, "slow");
					}else{
						$(leftul[i]).animate( {
							height : 'toggle',
							opacity : 'toggle'
						}, "slow");
					}
				} else {
					//关闭
					if ($(leftul[i]).css("display") == "block") {
						$(leftul[i]).animate( {
							height : 'toggle',
							opacity : 'toggle'
						}, "slow");
					}
				}
			}
		}
	</script>
</head>
<body id="indexMenu">
	<ul id="navLeft" class="leftdiv">
		<li class="menuTitle">
			系统菜单
		</li>
		<s:iterator value="menus" var="mainMenu" status="mainMenuStatus">
		<s:if test="showEnabled">
			<li class="leftli">
				<a href="<s:property value="url" default="#" />"<s:if test="url!=null"> target="mainFrame"</s:if> class="a1"><s:property value="name" /></a>
				<ul class="leftul">
					<s:iterator value="%{#mainMenu.menus}" var="subMenu" status="subMenuStatus">
					  <s:if test="showEnabled">
						<li>
						  <a href="<s:property value="url" />" target="mainFrame">
							<s:if test="menuImage==null||menuImage==''">
							  	<div class="menuImage">
							  		<div class="menuIcon">
										<img alt="<s:property value="description" />" src="<s:property value="icon" default="../images/data_acc.png" />" />
							  		</div>
									<span><s:property value="name" /></span>
							  	</div>
							</s:if><s:else>
								<img alt="<s:property value="description" />" src="<s:property value="menuImage" />" />
							</s:else>
						  </a>
						</li>
					  </s:if>
					</s:iterator>
				</ul>
			</li>
		</s:if>
		</s:iterator>
	</ul>
</body>
</html>
